home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / btree / IXBTree.h next >
Text File  |  1993-12-14  |  2KB  |  71 lines

  1. /*
  2. IXBTree.h
  3. Copyright 1991, NeXT, Inc.
  4. */
  5.  
  6. #import <mach/cthreads.h>
  7. #import    <objc/Object.h>
  8.  
  9. #import    "protocols.h"
  10.  
  11. #import    <store/IXStoreFile.h>
  12.  
  13. #ifdef    NX_COMPILER_RELEASE_3_0
  14. @interface IXBTree: Object <IXNameAndFileAccess, IXComparatorSetting, IXComparisonSetting>
  15. #else    NX_COMPILER_RELEASE_3_0
  16. @interface IXBTree: Object
  17. #endif    NX_COMPILER_RELEASE_3_0
  18. {
  19. @public
  20.     struct mutex    mutexLock; // public for explicit locking
  21. #ifdef    NX_COMPILER_RELEASE_3_0
  22. @protected
  23. #endif    NX_COMPILER_RELEASE_3_0
  24.     vm_offset_t        _rootOffset;
  25.     unsigned        _recordCount;
  26.     unsigned        _syncVersion;
  27.     unsigned        _codeVersion;
  28.     unsigned        _blockShift;
  29.     unsigned        _btreeDepth;
  30.     boolean_t        _freeStore;
  31.     char        *_handleName;
  32.     unsigned        _handle;
  33.     IXStore        *_store;
  34.     IXComparator    *_comparator;
  35.     void        *_context;
  36.     char        *_comparison;
  37.     struct BTreeStore    *_btreeStore;
  38.     struct        {
  39.     unsigned    isSpanning:1;
  40.     unsigned    rightRotation:1;
  41.     unsigned    leftRotation:1;
  42.     }            _cursorStatus;
  43. }
  44.  
  45. // Returns the store, e.g., [[client store] startTransaction].
  46. - (IXStore *)store;
  47.  
  48. - (unsigned)count; // returns the number of key/record pairs
  49. - empty; // removes all key/record pairs
  50.  
  51. - compact; // this method is not implemented, but remains for compatibility
  52. - (unsigned)keyLimit; // returns the maximum key length
  53.  
  54. - optimizeForTime; // faster insertion, more empty space per page
  55. - optimizeForSpace; // slower insertion, less empty space per page
  56.  
  57. // This method causes records to span node boundaries for optimal space 
  58. // utilization.  It renders the resulting B* tree unchangeable, however, and 
  59. // attempting to modify a spanned B* tree will produce an exception.  The 
  60. // records must be added to the B* tree in key order when spanning is enabled.
  61.  
  62. - setSpanning:(BOOL)flag;
  63.  
  64. // These macros accquire and release the public mutex lock instance variable.  
  65. // The lock is advisory only.  Callers must cooperate to obtain thread safety.
  66.  
  67. #define    IXLockBTreeMutex(btree)    mutex_lock(&(btree)->mutexLock)
  68. #define IXUnlockBTreeMutex(btree) mutex_unlock(&(btree)->mutexLock)
  69.  
  70. @end
  71.